Security News
The Risks of Misguided Research in Supply Chain Security
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
window-resize-subject
Advanced tools
[![npm version](https://badge.fury.io/js/window-resize-subject.svg)](https://badge.fury.io/js/window-resize-subject) [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT) ![CI](https://github.com/mya-ak
Handler for the window resize event of the observer pattern.
npm
$ npm i window-resize-subject
yarn
$ yarn add window-resize-subject
import { WindowResizeSubject } from 'window-resize-subject';
// create subject
const subject = new WindowResizeSubject();
// add observer
const observer = ({ width, height }) => {
// do something
};
subejct.addObserver('name', observer);
// start watching the resize event
subject.subscribe();
note: You can also write in a method chain
subejct.addObserver('name', observer).subscribe();
string
| Symbol
WindowResizeObserver
(event: { width: number, height: number }) => void
Add observer.
And called with the current window size.
subejct.addObserver('name', ({ width, height }) => {
// do something
});
Start watching the resize event.
Stop watching the resize event.
note: observer is not deleted.
Object
number
number
Force update.
subject.notifyObservers({ width: 800, height: 600 });
string
| Symbol
Deletes the specified Observer.
subject.deleteObserver('name');
Deletes all Observers.
number
Changes the delay time for a resize event.
subject.setDelay(100);
returns true if it has an observer.
Dispatches the current window size.
delay
(option)number
33
Changes the delay time for a resize event.
import { WindowResizeSubject } from 'window-resize-subject';
const subject = new WindowResizeSubject({ delay: 100 });
If you find a bug or want to contribute to the code or documentation, you can help by submitting an issue or a pull request.
FAQs
[![npm version](https://badge.fury.io/js/window-resize-subject.svg)](https://badge.fury.io/js/window-resize-subject) [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT) ![CI](https://github.com/mya-ak
We found that window-resize-subject demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.